package com.chinackts.customsdeclarations.controller;

import com.alibaba.fastjson.JSONObject;
import com.chinackts.customsdeclarations.dto.CustomsDeclarationsListDto;
import com.chinackts.customsdeclarations.query.CustomsDeclarationsDetailsQuery;
import com.chinackts.customsdeclarations.query.CustomsDeclarationsListQuery;
import com.chinackts.customsdeclarations.query.CustomsDeclarationsPageListQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

/**
 * @author Lianhong
 * @since 2021/11/18
 */
@Api(tags = "出口报关单")
public interface CustomsDeclarationsControllerInterface {

    @ApiOperation("查询报关单列表")
    @GetMapping("/{id}/customs-declarations")
    ResponseEntity<CustomsDeclarationsListDto> list(@PathVariable String id, @Valid CustomsDeclarationsListQuery query);

    @ApiOperation("分页查询报关单列表")
    @GetMapping("/{id}/customs-declarations/paging")
    ResponseEntity<CustomsDeclarationsListDto> pageList(@PathVariable String id, @Valid CustomsDeclarationsPageListQuery query);

    @ApiOperation("查询报关单明细")
    @GetMapping("/{id}/customs-declarations/{entryId}")
    ResponseEntity<JSONObject> details(@PathVariable String id, @PathVariable String entryId, @Valid CustomsDeclarationsDetailsQuery query);

    @ApiOperation("查询报关单明细")
    @PostMapping("/{id}/customs-declarations/{entryId}")
    ResponseEntity<JSONObject> customsDeclarationDetails(@PathVariable String id, @PathVariable String entryId, @Valid @RequestBody CustomsDeclarationsDetailsQuery query);

    @ApiOperation("报关单PDF下载")
    @GetMapping("/{id}/customs-declarations/{entryId}/pdf")
    ResponseEntity<Void> customsDeclarationsPdf(@PathVariable String id, @PathVariable String entryId, HttpServletResponse response);

}
